Add vim support to brev open command #245
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add vim support to brev open command
Summary
Adds vim support to the
brev openCLI command, allowing users to runbrev open <instance> vimto SSH into a brev instance and launch vim in the home directory. The implementation follows the established pattern used by tmux support, including automatic installation checking.Key Changes:
EditorVim = "vim"constant to supported editor typeshandleSetDefault()anddetermineEditorType()to include vimopenEditorByType()andgetEditorName()functionsopenVim()function that SSHs into instance and launches vimensureVimInstalled()function that checks for vim and installs it automatically if missingrunOpenCommand()with informative messagesThe vim implementation uses the same SSH-based approach as tmux:
ssh -t <alias> 'cd <path> && vim'Review & Testing Checklist for Human
brev open <instance> vimwith an actual brev instance to ensure vim launches correctly in the home directory-dflag)code,cursor,windsurf,tmux) to ensure they still work correctly after these changesDiagram
%%{ init : { "theme" : "default" }}%% graph TD CLI["brev open <instance> vim"] --> runOpenCommand["runOpenCommand()"] runOpenCommand --> determineEditorType["determineEditorType()"] determineEditorType --> openEditorByType["openEditorByType()"] openEditorByType --> openVim["openVim()"]:::major-edit openVim --> ensureVimInstalled["ensureVimInstalled()"]:::major-edit ensureVimInstalled --> sshVim["SSH: 'cd $HOME && vim'"] runOpenCommand --> errorHandling["Error Handling"]:::minor-edit errorHandling --> vimNotFound["vim: command not found<br/>Auto-install message"]:::minor-edit constants["Editor Constants"]:::minor-edit validation["Validation Logic"]:::minor-edit helpText["Help Text & Examples"]:::minor-edit subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
Implementation follows tmux pattern: The vim support closely mirrors the existing tmux implementation, including the SSH approach, installation checking, and error handling patterns.
Linting note: There's a cyclomatic complexity warning due to additional error handling in
runOpenCommand(), but this follows the established pattern used by other editors.Testing limitation: The implementation couldn't be tested end-to-end during development since it requires actual brev instances to SSH into. Human testing is critical to verify functionality.
Link to Devin run: https://app.devin.ai/sessions/bfdf3682604243ae98caa1a810a5d9d9
Requested by: @theFong